import java.awt.*;
import java.awt.image.*;
import java.awt.image.DataBufferFloat;
import java.io.IOException;

import javax.media.jai.*;


public class criaImagemJAI {


	public static void main(String[] args) throws IOException{
		int largura = 256;
		int altura = 256;
		float[] imageData = new float[largura * altura];		
		int count = 0;
		
		for (int h=0; h<altura; h++)
			for (int w=0; w<largura; w++){
				imageData[count++] = 20f*w*h;
				
				DataBufferFloat dbuffer = new DataBufferFloat (imageData, largura*altura);
				SampleModel samplemodel = RasterFactory.createBandedSampleModel(DataBuffer.TYPE_FLOAT, largura, altura, 1);
				ColorModel colormodel = PlanarImage.createColorModel(samplemodel);
				WritableRaster raster = RasterFactory.createWritableRaster(samplemodel, dbuffer, new Point(0,0));
				TiledImage tiledImage = new TiledImage(0,0,largura,altura,0,0,samplemodel,colormodel);
				
				tiledImage.setData(raster);
				JAI.create("filestore", tiledImage,"floatpattern.tif", "TIFF");
				

				
			}

	}

}
